@extends('layouts.app')
@include('user.sidebar')
@section('content')
    <div class="content">
        <div class="row custom-invoice">
            @if (!is_null($apply))
                <a class="btn btn-info btn-sm" href="{{ route('admin.user.index', ['level' => 2]) }}"> 返回 </a>
                @can('user-apply-edit')
                <a class="btn btn-success btn-sm" href="{{ route('admin.user.partner.edit', ['id' => $apply->id, 'sidebar' => 'index2', 'upstream' => 'show']) }}"> 编辑</a>
                @endcan
                <br />
                <br />
                <table class="table table-bordered table-hover dataTable">
                    <tr>
                        <td rowspan="2" style="max-width: 60px;">
                            <img src="{{ $user->avatar }}" width="50" />
                            <br />
                            <br />
                            {{ $user->mobile  }}
                        </td>
                        <td style="font-weight: bold; font-size: 16px;">姓名</td>
                        <td style="font-weight: bold; font-size: 16px;" colspan="2">身份证号</td>
                    </tr>
                    <tr>
                        <td>{{ $apply->name??"" }}</td>
                        <td colspan="2">{{ $apply->id_number??'' }}</td>
                    </tr>
                    <tr>
                        <td style="font-weight: bold; font-size: 16px;">昵称：</td>
                        <td>{{ $user->nickname }}</td>
                        <td style="font-weight: bold; font-size: 16px;">职业：</td>
                        <td>{{ $apply->job??"" }}</td>
                    </tr>
                    <tr>
                        <td style="font-weight: bold; font-size: 16px;">工作单位：</td>
                        <td>{{ $apply->company??"" }}</td>
                        <td style="font-weight: bold; font-size: 16px;">住址：</td>
                        <td>{{ $apply->address??"" }}</td>
                    </tr>
                    <tr>
                        <td style="font-weight: bold; font-size: 16px;">邀请人：</td>
                        <td>{{ $referrer->name??"" }}</td>
                        <td style="font-weight: bold; font-size: 16px;">状态：</td>
                        <td>{{ is_null($apply)?"":\App\Modules\User\Models\ApplyPartner::$statusShow[$apply->status] }}</td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <img src="{{ $apply->image }}" onmouseover="this.style.cursor='pointer';this.style.cursor='hand'" onmouseout="this.style.cursor='default'" onclick="javascript:showimage('{{ $apply->image }}');" height="200">
                        </td>
                        <td colspan="2">
                            <img src="{{ $apply->id_card[0] }}" onmouseover="this.style.cursor='pointer';this.style.cursor='hand'" onmouseout="this.style.cursor='default'" onclick="javascript:showimage('{{ $apply->id_card[0] }}');" height="200">
                            <img src="{{ $apply->id_card[1] }}" onmouseover="this.style.cursor='pointer';this.style.cursor='hand'" onmouseout="this.style.cursor='default'" onclick="javascript:showimage('{{ $apply->id_card[1] }}');" height="200">
                        </td>
                    </tr>
                </table>
            @else
                @can('user-apply-edit')
                <a class="btn btn-success" href="{{ route('admin.user.partner.create', ['user_id' => $user->id, 'sidebar' => 'index2']) }}"> 添加</a>
                @endcan
            @endif
        </div>

        <div class="modal fade" id="showImage" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div style="text-align: center">
                <div class="modal-content" style="width: 80%; margin: auto">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> 关闭 </button>
                    </div>
                    <div class="modal-body">
                        <img id="show_id" src='' class='carousel-inner img-responsive img-rounded' />
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
        </div>
    </div>
@endsection

@push('scripts')
    <script>
        function showimage(image)
        {
            $("#showImage").find("#show_id").attr('src', image);
            $("#showImage").modal('show');
        }
    </script>
@endpush
